home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15419 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.mira.net.au!news
  2. From: davidw@werple.net.au (David White)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Is this a memory leak?
  5. Date: 5 Apr 1996 21:19:58 +1000
  6. Organization: Werple Internet, Melbourne
  7. Message-ID: <4k2vku$s82@werple.net.au>
  8. References: <4jv214$gv7@insosf1.netins.net> <4k02v5$tu7@grimsel.zurich.ibm.com>
  9. NNTP-Posting-Host: werplez.mira.net.au
  10.  
  11. wgk@zurich.ibm.com (Keith Whittingham) writes:
  12.  
  13.  
  14. >The dto, ~TopClass, is a going to try and free some memory at the address
  15. >0x000 but, by a quirk of implmentation, will probably not blow up (as a 
  16. >simple call to free(0) would). Instead the compiler probably generates
  17. >code to check that the object address is 0, it so there is no deallocation
  18. >of the memory.
  19.  
  20. The use of 0 as a pointer is not the address 0x000. It is a null pointer
  21. as defined by the language. Implementations are not even required to use a
  22. bit pattern of all zeroes as a null pointer. They can use any value they
  23. like, as long as it will not also be used as a real address. Furthermore,
  24. rather than being a quirk of implementation, the language guarantees that
  25. deleting a null pointer will do nothing. 
  26.  
  27. David White
  28. davidw@werple.mira.net.au
  29.